package com.changgou.seckill.controller;

import com.changgou.entity.Result;
import com.changgou.entity.StatusCode;
import com.changgou.seckill.pojo.SeckillGoods;
import com.changgou.seckill.service.SecKillGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @description:
 * @author: 大佬味的小男孩
 * @date: 2020-08-07 18:44
 **/
@RestController
@RequestMapping("/seckillgoods")
public class SecKillGoodsController {


    @Autowired
    private SecKillGoodsService secKillGoodsService;


    @RequestMapping("/list")
    public Result<List<SeckillGoods>> list(@RequestParam("time") String time) {
        List<SeckillGoods> seckillGoodsList = secKillGoodsService.list(time);
        return new Result<List<SeckillGoods>>(true, StatusCode.OK, "查询秒杀商品成功", seckillGoodsList);
    }
}
